package org.jeecg.modules.yw.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.yw.entity.Messages;
import org.jeecg.modules.yw.vo.MessageVo;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@Mapper
public interface MessagesMapper extends BaseMapper<Messages>{
    @Update("update messages set state = 1, reason = #{reason},remark=#{remark} where id = #{msgId}")
    public int updateMessage(@Param("msgId") String msgId, @Param("reason") String reason, @Param("remark") String remark);
    
    @Select("SELECT * FROM messages where orderId = #{orderId} and (orderMsgType = 4 or orderMsgType = 5) and state = 0 and delFlag = 0")
    public List<Messages> getOrderByOrderNo(@Param("orderId") String orderId);    
    
    
    @Update("update messages set state = 1, remark=#{remark} where id = #{msgId}")
    public int confirmMessage(@Param("msgId") String msgId, @Param("remark") String remark);
    
    

    
    IPage<MessageVo> getAllMessages(Page<MessageVo> page, @Param(Constants.WRAPPER) QueryWrapper<MessageVo> queryWrapper);
}
